from decimal import Decimal 

"""金额工具"""

def scale_down_100x(amount):
    dcm = Decimal(int(amount)/100)
    dstr = '{:.2f}'.format(dcm)
    return dstr

def scale_up_100x(amount: str):
    dcm = Decimal(amount) * 100
    int_amt = int(dcm.to_integral_value())
    return int_amt


def int_amount_to_decimal_str(amount: int):
    dcm = Decimal(amount/100)
    dstr = '{:.2f}'.format(dcm)
    return dstr

def decimal_str_to_int_amount(amount: str):
    dcm = Decimal(amount) * 100
    int_amt = int(dcm.to_integral_value())
    return int_amt


